<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../plugins/vue.min.js"></script>
    <style>
        
    </style>
</head>
<body>
    <div id="box">
        <home>
            <div slot="a">插槽1</div>
            <div>插槽2</div>
            <div>插槽3</div>
        </home>

        <navbar>
            <button slot="left">左边</button>
            <button slot="right">右边</button>
        </navbar>

    </div>
    
    <script>
        // <slot></slot>  插槽,会显示home里面的,可以加上name属性,那么就会只显示=name的值的
        Vue.component("home",{
            template:`
            <div>
                <slot></slot>
                <slot name = "a"></slot>
                 </div>
            `
        })
        Vue.component("navbar",{
            template:`
            <div>
               <slot name="left"></slot>
               <span>我是文本</span>
               <slot name="right"></slot>
                 </div>
            `
        })
        
        let vm =  new Vue({
            el:"#box",
            data:{
                which:'home'
            }

        })
    </script>
</body>
</html>